int subtractProductAndSum(int n)
{
    int mul = 1, sum = 0;
    int ret = 0;
    while (n)
    {
        ret = n % 10;
        mul *= ret;
        sum += ret;
        n /= 10;
    }
    return mul - sum;
}